<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="lib/react.development.js"></script>
    <script src="lib/react-dom.development.js"></script>
    <script src="lib/babel.min.js"></script>

</head>
<body>
    <div id="root"></div>

    <script type="text/babel">
        const root = ReactDOM.createRoot(document.getElementById("root"));

        class App  extends React.Component {
            myDiv = React.createref();
            child = React.createref();
            userName = React.createref();
            render(){
                return (
                    <div ref={this.mydiv}>嘎嘎嘎</div>,
                    <input ref={this.userName} name={"userName"} type="text"/>,
                    <Child ref={this.child}></Child>,
                    <button onClick={(e)=>{
                        e.preventDefault();
                        console.log(this.myDiv.current.innerText);

                    }}>
                    
                    
                    
                    
                    点一下</button>
                )
                    
                
            }
        }
        root.render((
            <App></App>
        ))
    </script>
</body>
</html>